<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Admin extends CI_Controller {

	public function __construct(){
		parent::__construct();
		$this->load->helper(array('form', 'url'));
	  	$this->load->model('menu_model');        // 加载菜单模型
	  	check_login(); // 检查是否登录
	}

	public function index()
	{
		// 加载菜单
		$data['rolesOneArr'] = $this->menu_model->get_all_pop(0);  // 一级菜单
		foreach($data['rolesOneArr'] as $rolesOneRows){
			$rolesSonArr[$rolesOneRows['menu_id']] =  $this->menu_model->get_all_pop($rolesOneRows['menu_id']);
		}
		$data['rolesSonArr'] = $rolesSonArr; // 子菜单
		$this->load->view('admin/index',$data);
	}
}
